package com.mgg.auth.controller;

import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: lijun
 * @Date: 2018/9/3 15:13
 */
@RestController
public class AuthController {

    @GetMapping(value = "/hi")
    public Object hi() throws Exception {
        return "hi";
    }

    @GetMapping("/me")
    public Object getCurrentUser(@AuthenticationPrincipal UserDetails user) {
        return user;
    }
}